package org.iweb.html.api;

import java.util.List;

public class JFunction {

	private String bodyFunction;
	private String innerFunction;

	public JFunction() {
	}
	
	public JFunction(String bodyFunction) {
		this.innerFunction=bodyFunction;
		this.bodyFunction="function(){"+innerFunction+"}";
	}
	
	public JFunction(JFunction... functions) {
		this.innerFunction="";
		for(JFunction j: functions){
			this.innerFunction+=j.innerFunction;
		}
		this.bodyFunction="function(){"+this.innerFunction+"}";
	}
	
	public JFunction(List<JFunction> functions) {
		this.innerFunction="";
		for(JFunction j: functions){
			this.innerFunction+=j.innerFunction;
		}
		this.bodyFunction="function(){"+this.innerFunction+"}";
	}
	
	public String getBodyFunction() {
		return bodyFunction;
	}

	public JFunction setBodyFunction(String bodyFunction) {
		this.bodyFunction = bodyFunction;
		return this;
	}
	
	public String getInnerFunction() {
		return innerFunction;
	}

	public void setInnerFunction(String innerFunction) {
		this.innerFunction = innerFunction;
	}

}
